#ifndef __COMMON_H__
#define __COMMON_H__

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>

/* TRUE, FALSE symbol for Boolean types*/
#ifndef TRUE
#define TRUE (1u)
#endif
#ifndef FALSE
#define FALSE (0u)
#endif

#define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline

#define PI 3.1415926535898
#define ARRY_SIZE 21

#define OneLtShift7 128U
#define OneLtShift8 256U
#define OneLtShift15 32768U
#define OneLtShift16 65536
#define OneLtShift31 2147483648UL
#define OneLtShift32 4294967296UL
#define OneLtShift63 9223372036854775808ULL
#define OneLtShift64 18446744073709551616ULL

#define U8_MAX 255
#define U8_MIN 0
#define S8_MAX 127
#define S8_MIN -128
#define U16_MAX 65535
#define U16_MIN 0
#define S16_MAX 32767
#define S16_MIN -32768
#define U32_MAX 4294967295
#define U32_MIN 0
#define S32_MAX 2147483647
#define S32_MIN -2147483648
#define U64_MAX ((uint64)~0ULL)
#define U64_MIN 0ULL
#define S64_MAX ((sint64)(U64_MAX >> 1))
#define S64_MIN ((sint64)(-S64_MAX - 1))

#define F32_MAX (3.4028235E38)
#define F32_MIN (-3.4028235E38)

typedef unsigned char boolean; /* for use with TRUE/FALSE      */
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;

typedef int8_t sint8;
typedef int16_t sint16;
typedef int32_t sint32;
typedef int64_t sint64;

typedef float float32;
typedef double float64;

enum RAMP_STATES { RISING = 1, FALLING = -1, END = 0 };
enum SWITCH_STATES { TARGET_A = 1, TARGET_B = -1, OFF = 0 };

#endif